<?php
$adminPrefix = '';
$viewParam = $assetData['Listing']['slug'];
$profileUrl = $assetData['ListingAsset']['poster']['profile_url'];
$galleryElement = 'comments';
if(isset($this->params['admin']))
{
	$adminPrefix = '/admin';
	$viewParam = $assetData['Listing']['id'];
	$profileUrl = '/admin/users/view/'.$assetData['ListingAsset']['poster']['id'];
	if($assetData['ListingAsset']['poster_entity'] == 'Guest')
	{
		$profileUrl = 'javascript::void();';
	}
	$galleryElement = 'admin_gallery_comments';
	
}?>

<div align="center">
			<?php echo $asset->preview($assetData['ListingAsset'], array('class'=>'', 'thumb'=>array('width'=>580,'height'=>580)));?>
<br/>
			<?php
			if(!isset($neighbors['prev']['ListingAsset']))
			{
				$prevLink = '<div class="disabled">'.__("Prev").'</div>';
			}
			else {
				$prevLink = $html->link(__("Prev"),$adminPrefix.'/listing_assets/view/'.$neighbors['prev']['ListingAsset']['id']);
			}
	
			if(!isset($neighbors['next']['ListingAsset']))
			{
				$nextLink = '<div class="disabled">'.__("Next").'</div>';
			}
			else
			{
				$nextLink = $html->link(__("Next"),$adminPrefix.'/listing_assets/view/'.$neighbors['next']['ListingAsset']['id']);
			}
			?>
			<?php echo $prevLink;?> | <?php echo $nextLink;?>
		<br/>
		
		<?php echo __("Uploaded By")?> <?php echo $html->link($assetData['ListingAsset']['poster']['display_name'],$profileUrl);?> |
		<?php echo $time->timeAgoInWords($assetData['ListingAsset']['created'],array('shortString'=>true));?> 
		<?php //echo $report->link("ListingAsset",$assetData['ListingAsset']['id'],array('title'=>"Report"))?>

	</div>
	
		<!-- comments code starts here-->
		<?php
			$moderationOnComment = cr('GeneralConfig.moderate_gallery_comment');
			$allowComment = cr('GeneralConfig.allow_comment_on_gallery');
			$commentStatus = AssetComment::PUBLISHED;
			if($moderationOnComment)
			{
				$commentStatus = AssetComment::UNPUBLISHED;
			}
			if($allowComment)
			{?>			
				<div class="clr"></div>
				<?php echo $comment->show(array('model'=>"AssetComment","conditions"=>array("AssetComment.status"=>AssetComment::PUBLISHED,'AssetComment.listing_asset_id'=>$assetData['ListingAsset']['id']),'element'=>$galleryElement,'cache'=>false));?>
				<!-- show comments related data when admin is false-->
				<?php if($adminPrefix == '')
				{?>		
					<div class="clr"></div>
					<?php echo $comment->showForm('AssetComment', $assetData['ListingAsset']['id'],'ListingAsset',array('url'=>array('controller'=>'asset_comments','action'=>"add",$assetData['ListingAsset']['id']),'commentStatus'=>$commentStatus));?>
				
				<?php
				}
				?>
		<?php }?>
		<!-- comments code ends here -->
